# -*- coding:UTF-8 -*-
import epic_operator as eo
import epic_event as ee
import logger
import traceback
import config
import sys
typeDic={"Maoxian94":"刷冒险9-4","RefreshShop":"刷商店"}
typeArr=[]
def event(count,type):
    conf=eval("config."+type.lower())
    data=ee.getImageData(conf)
    i=1
    if count<=0:
        count=99999
    while(i<=count):
        logger.info('第'+str(i)+"次"+typeDic[type])
        eval("ee.loop"+type+"(data)")    
        i+=1     

# print(eo.matchPos(eo.getSingleImageData("maoxian_mapheizhizhu.png","img"),eo.getSingleImageData("maoxian94/map.png")))
# sys.exit()
index=0
inputString=""
for key,value in  typeDic.items():
	
    typeArr.append(key)
    inputString=inputString+str(index)+"."+value
    inputString=inputString+"\n"  
    index=index+1
choice = int(input(inputString))
count = int(input("输入循环次数(0不限次数)\n"))
if choice>=0:
    try:
        event(count,typeArr[int(choice)])
    except BaseException as e:
        logger.info(traceback.format_exc())    